package com.zds.support.api.retrofit.function;

import io.reactivex.Observable;
import io.reactivex.functions.Function;

public class ApiErrorFunction<T> implements Function<Throwable, Observable<T>> {
    private String url;

    public ApiErrorFunction() {

    }

    public ApiErrorFunction(String url) {
        this.url = url;
    }

    @Override
    public Observable<T> apply(Throwable throwable) throws Exception {
        return Observable.error(ExceptionEngine.handleException(url, throwable));
    }
}
